<?php
/*
 * Created on 2012-12-25
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
  include("../nncms_manager_inc.php");
  include_once LOGIC_DIR.'template'.DIRECTORY_SEPARATOR.'template_policy.class.php';
  

  
  $dc = nl_get_dc(array (
		'db_policy' => NL_DB_WRITE,
		'cache_policy' => NP_KV_CACHE_TYPE_MEMCACHE
			));
	$dc->open();
 
  
 
  $action=$_REQUEST['action'];
  switch ($action){
  	case 'delete':
  		$result=delete_template_policy($dc);
  	break;
  	case 'modify':
  		$result=modify_template_policy($dc);
  	break;
  }
   echo  json_decode($result);
  
  function delete_template_policy($dc){
  	$policy_id=$_REQUEST['id'];
  	$result=nl_template_policy::delete_template_policy_by_id($dc,$policy_id);
  	return $result;
  }
  
  function modify_template_policy($dc){
  	  $policy_id=$_REQUEST['id'];
  	$tags=$_REQUEST['tags'];
  	 $result=nl_template_policy::modify_template_policy_tag($dc,$policy_id,$tags);
  	 return $result;
  }
?>
